﻿using MediatR;
using T.Vehicleservice.API.Application.Command.ViolationRecordCommand;
using T.Vehicleservice.Repository.Interface;

namespace T.Vehicleservice.API.Application.CommandHandlers.ViolationRecordHandler
{
    /// <summary>
    /// 新增违章记录
    /// </summary>
    public class ViolationRecordCreateCommandHander : IRequestHandler<ViolationRecordCreateCommand, int>
    {
        private readonly IViolationRecordRepository _violationRecordRepository;
        public ViolationRecordCreateCommandHander (IViolationRecordRepository violationRecordRepository)
        {
            _violationRecordRepository = violationRecordRepository;
        }
        public async Task<int> Handle(ViolationRecordCreateCommand request, CancellationToken cancellationToken)
        {
            return await _violationRecordRepository.AddAsync(request);
        }
    }
}
